Repository navigation
fix(agc): prepare a rect-list draw's missing rectangle at draw from its prepared stages - #1928
Conversation
klosixgaming-arch
left a comment
There was a problem hiding this comment.
Small, correct, and the test strategy is the right one for a code path that otherwise can only be reached by a full GPU draw.
- Commit 1 (move the lookup into
DrawRectangle) is behaviour-preserving and gives a callable seam for the test — good reasoning, and the test genuinely fails onmain+commit-1 and passes on this branch. - The fallback only fires on a lookup miss, calls
ResolvePreparedGraphics, then re-looks-up; any other failure still throws. No silent stub, no guessing. - Interacts correctly with #1902 (null pixel program prepared at draw).
One note (non-blocking): the fallback hard-codes 17 as the primitiveType passed to ResolvePreparedGraphics. Everywhere else the primitive type comes from the decoded draw state. If a rect-list draw can legitimately be issued with a different primitive type, preparing with 17 may produce a rectangle that doesn't match. Please confirm rect-list draws are always type 17 (or pull the real value from the packet if not) — that's the only thing I'd want grounded before this is a long-term fix rather than a workaround.
Written with AI assistance.
|
#1825 and #1732 change the same lines in So the changes don't duplicate each other, but they will conflict. Whichever lands first, I'm happy to rebase so both cases go through one helper ( AI-assisted: yes |
|
I verified the primitive-type question against the current decoder: |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the full diff and current head. The helper move is behavior-preserving, the fallback only runs on a missing rectangle, and the execution test exercises the prepared-fragment case. I checked that primitive values 7 and 17 both enter the rect-list path and generate the same rectangle request. Linux and Windows checks and Conventions are green. The author has also documented the distinct overlapping triggers in #1732/#1825 and offered to rebase as needed.
|
Tested this with Hades II (PPSA36082), together with a fix for the null program miss (the registration fix I described on #1902). The fallback kicks in once while the level loads, for the null fragment program, and the game goes on to gameplay without problems. |
|
Uncharted: Legacy of Thieves Collection (PPSA05684) stops here once its fragment variants are prepared at the draw (locally: the null pixel program and its own shaders, see #1902): I fixed it locally the same way (build the rectangle pair from the prepared stages at the draw and keep it with the snapshot) to reach the title's main menu. Separately, the fault buffer of the built control/evaluation shaders could collide with another stage's binding group; that fix is #2198. I have not run this branch itself with the title. |
|
Astro's Playroom (PPSA01325) hits this on Windows with NVIDIA, right after #1902. Setup:
Windows 11, RTX 3060 Laptop (NVIDIA 616.92), WinLibs GCC 15.2. 🤖 Generated with Claude Code |
|
Tested with Sonic Origins (PPSA05324) on Linux, R9 380 (RADV). Its depth/stencil clears are rect-list draws without a pixel program, so they stopped at Bring-up thread: #2021 |
|
Tested on Windows with Marvel's Wolverine (PPSA03671), after #1902. Setup: Windows 11 Pro (10.0.26200), RTX 3070, GCC 15.2.0 UCRT (WinLibs), Release. This PR (def0be1) merged onto main 54f28f2 with #1836, #1893, #1709, #1837, #1940, #2022, #2219, #1902, and a local change that lets Without this PR: the first presentation fails with With this PR: the rect-list draws pass. The next stop is a compute shader deferred at registration: Limits: one title, one run each way. No frame is presented yet. |
|
Checked the lookup move is behaviour-preserving, the fallback only runs on a missing rectangle (any other failure still throws), and primitive types 7/17 take the same rect-list path. Build + ctest of libSceAgcDriver green (273/273, Note: #2261 touches the same lines in |
…ngle-fallback fix(agc): prepare a rect-list draw's missing rectangle at draw from its prepared stages
Closes #1927
What
A rect-list draw needs a prepared rectangle for its (front, vertex variant, fragment variant). Rectangles are built only when the title resolves the graphics ABI through
sceAgcCreateInterpolantMapping. A fragment variant prepared at the draw (the null pixel program, or a shader deferred at registration) therefore has none, and the draw throwsprepared rectangle artifacts are missing.There are two commits:
refactor(agc): look up a rect-list draw's rectangle through DrawRectanglemoves the lookup intoDrawRectangle(front, fragment, vertexId, fragmentId, target). Behaviour is unchanged.fix(agc): prepare a rect-list draw's missing rectangle at draw from its prepared stages: when the lookup misses,DrawRectanglelogs it, callsResolvePreparedGraphics(front, fragment, 17, target)and looks it up again. Any other failure still throws.Tested
Linux (Nobara 44, GCC), RTX 5070 Ti, NVIDIA 595.91.07.
The new check in
tests/execution/PreparedGraphics.cppprepares a fragment variant that was never linked to the front through the ABI, then draws a rectangle with it throughDrawRectangle.ctest -R agc_driver_prepared_graphicsmain1be6f9f + commit 1 (lookup moved, no behaviour change) + the testAGC driver: prepared rectangle artifacts are missingRect-list draw of shader ... has no rectangle for fragment shader ...; preparing it at drawThe test can't run on
mainwithout commit 1. The draw path has no function a test can call short of a full GPU draw, and the ctest suite has no harness for that. Commit 1 adds that function without changing behaviour, so the test builds and fails there because of the bug, not because it doesn't compile. I can squash the two commits if you prefer one.The
agc_driver_prepared_shaders*tests andpixel_ancillaryalso pass on the combined branch.Stray, with #1902: without this change it aborts on the first rect-list draw that uses the null pixel program. With it, the log shows
Rect-list draw of shader 0x200bbe0000 has no rectangle for fragment shader ...; preparing it at drawand the run continues to a later, unrelated error.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository